<template>
  <el-dropdown
    @command="val => emit('command', val)"
    trigger="click"
  >
    <span class="el-dropdown-link">
      {{ value }}
      <el-icon class="el-icon--right">
        <arrow-down />
      </el-icon>
    </span>
    <template #dropdown>
      <el-dropdown-menu>
        <el-dropdown-item command="宝贝">宝贝</el-dropdown-item>
        <el-dropdown-item command="店铺">店铺</el-dropdown-item>
      </el-dropdown-menu>
    </template>
  </el-dropdown>
</template>

<script setup>
import { toRefs } from 'vue';
import { ArrowDown } from '@element-plus/icons-vue'
const props = defineProps({
  value: {
    type: String,
    default: ''
  }
})
const emit = defineEmits(['command'])
const { value } = toRefs(props);
</script>
<style lang="scss" scoped>
.el-dropdown-link {
  cursor: pointer;
  color: var(--el-color-primary);
  display: flex;
  align-items: center;
}
</style>